<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>问题反馈</title>
	<jsp:include page="../../import.jsp" flush="true" />
	<script type="text/javascript">
		var grid = null;
		var callback = function () {
			grid.reload();
		};
		$(function () {
			initForm();
			initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
			searchBtnEvent();
			clearBtnEvent();
		});

		//清空按钮事件
		function clearBtnEvent(){
			$("#clearBtn").click(function(event) {
				clearLigerForm("searchBar");
			});
		}

		//初始化表单
		function initForm(){
			$("#searchBar").ligerForm();
		}

		//查询按钮事件
		function searchBtnEvent(){
			$("#searchBtn").click(function(event) {
				var form = new liger.get("searchBar");
				var data = form.getData();
				for (name in data){
					grid.setParm(name,data[name]);
				};
				grid.reload();
			});
		}

		//初始化列表
		function initGrid(){
			$("#ligergrid1").ligerGrid({
				url: '<%=path%>/custpay/cmmCstProposal/initCmmCstProposalList.do',
				method : 'get',
				columns: [
					{ display: '手机号', name: 'clientPhone', width: 150 , align: 'center', enabledSort:true},
					{ display: '姓名', name: 'clientName', width: 100 , align: 'center', enabledSort:true},
					{ display: '反馈内容', name: 'content', minWidth: 200 , align: 'center', isEllipsis: false, enabledSort:true},
					{ display: '反馈时间', name: 'crtTm', render:renderDate, width: 150 , align: 'center', enabledSort:true},
                    { display: '处理状态', name: 'prpslStsNm', width: 80 , align: 'center', enabledSort:true},
                    { display: '处理结果', name: 'finResult', minWidth: 150 , align: 'center', isEllipsis: false, enabledSort:true},
                    { display: '处理人', name: 'mdfUsrNm', minWidth: 80 , align: 'center', isEllipsis: false, enabledSort:true},
                    { display: '系统类型', name: 'osCdNm', minWidth: 80, align: 'center', enabledSort:true},
                    { display: 'APP版本号', name: 'appCode', minWidth: 80, align: 'center', enabledSort:true},
					{
						display: '操作',width: 150,
						render: function (rowdata, rowindex, value){
							var h1 = '<a class="sq-button-hasicon" href="javascript:void(0);" onclick="seeCmmCstProposal('+rowdata.id+')">查看</a>';
                            var h3 = '';
                            if(rowdata.prpslSts=='0' || StringUtils.isEmpty(rowdata.prpslSts)){
                                h3 = '<a class="sq-button-hasicon" href="javascript:void(0);" onclick="modifyCmmCstProposal('+rowdata.id+')">处理</a>';
                            }
							return h1+'&nbsp;&nbsp'+h3;
						}
					}
				],
				pageSize:10,
				root:'rows',
				record:'total',
				rownumbers: true,
                checkbox:true,
				hideLoadButton : true,
				width: '100%',
				height:'100%',
				heightDiff:-2,
				fixedCellHeight: false
			});
			grid = liger.get("ligergrid1");
			grid.setHeight(100);
		}

		//格式化时间
		function renderDate(rowdata, index, value){
			var dateStr = "";
			if(null != value){
				var date = new Date(value);
				dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
			}
			return dateStr;
		}
        //查看详情
        function seeCmmCstProposal(id){
            var tit = '查看问题详情';
            var tabid='seeCmmCstProposal'+id;
            Add_navTab(tabid, tit, '<%=path%>/custpay/cmmCstProposal/seeCmmCstProposalPage.do?id='+id, callback);
        }
        //查看详情
        function modifyCmmCstProposal(id){
            var tit = '处理问题';
            var tabid='modifyCmmCstProposal'+id;
            Add_navTab(tabid, tit, '<%=path%>/custpay/cmmCstProposal/modifyCmmCstProposalPage.do?id='+id, callback);
        }

        //删除数据
        function removeByIds(){
            var selectedRows = grid.getSelectedRows();
            if(selectedRows.length == 0){
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW , SQ_type: "warning" });
                return;
            }

            var _ids = [];
            for ( var index in selectedRows) {
                _ids.push(selectedRows[index].id);
            }
            $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if(flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType:'json',
                    data:{ids:JSON.stringify(_ids)},
                    url: '<%=path%>/custpay/cmmCstProposal/removeByIds.do',
                    beforeSend: function(){
                        wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
                    },
                    success:function(msg){
                        wait_dialog.close();
                        if(msg.success == 1){
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                            grid.reload();
                        }else{
                            $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                        }
                    }
                });
            });
        }
	</script>
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
			<div class="fieldset1 tabel_col clearFix">
				<div class="fieldBox col_33">
					<div class="label">手机号</div>
					<div class="field">
						<input name="clientPhone" id="clientPhone" type="text" class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">姓名</div>
					<div class="field">
						<input name="clientName" id="clientName" type="text" class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">反馈消息</div>
					<div class="field">
						<input name="content" id="content" type="text" class="ui-textbox" value="">
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">处理状态</div>
					<div class="field">
						<select name="prpslSts" id="prpslSts" validate="{required:true,select:true}">
							<option value=" " >请选择</option>
							<option value="0" >未处理</option>
							<option value="1" >已处理</option>
						</select>
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">反馈时间(起)</div>
					<div class="field">
						<input name="crtTmBegin" id="crtTmBegin" type="text" class="ui-datepicker" value="">
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">反馈时间(止)</div>
					<div class="field">
						<input name="crtTmEnd" id="crtTmEnd" type="text" class="ui-datepicker" value="">
					</div>
				</div>
			</div>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
               <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
				<span id="delBtn" class="sq-button sq-button-hasicon" onclick="removeByIds();"><i class="sqBtnIco_7"></i>删除</span>
               <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
            </div>
        </form>
    </div>
	<div id="ligergrid1" class="sq-grid"></div>
</div>
</body>
</html>